<?php
namespace App\Http\Controllers\Api;

use App\Models\Category;
use App\Http\Resources\Api\Categories as CategoryCollection;

class GoodsController extends Controller
{
    public function index()
    {
        $result = Category::with('goods')
        ->orderByDesc('sort')
        ->orderBy('id')
        ->get();
        return new CategoryCollection($result);
    }
}
